<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>03_初步使用作用域插槽</title>
</head>
<body>
    <div id="app">
     <son-com>
          <template v-slot:son="aa">
             {{aa.userss.lastName}}
         </template>

         <template v-slot:son2="bb">
             <li>{{bb.movie}}</li>
         </template>
     </son-com>
    </div>
</body>
<script src="../vue.js"></script>
<script>
    const sonCom = {
        template: `
            <div>
                <slot name="son" :userss="user">子组件数据：{{user.firstName}}</slot>
                <ul>
                  <slot name="son2" v-for="movie in movies" :movie="movie"></slot>
                </ul>
            </div>
        `,
        data(){
            return {
                user:{
                    firstName: '张',
                    lastName: '三'
                },
                movies: ["肖生客的救赎","蝙蝠侠","变形精钢","忍者神龟"],
            }
        }
    }

    new Vue({
        el: '#app',
        components: {
            sonCom
        }
    })
</script>
</html>